<?php

class DBFactory {
	
	static public function getDbConnection() {
		if (!class_exists('PDO')) {
			throw new Exception('Could not connect to database, PDO method does not exists on this server');
		};
		$db = new PDO(DB_DSN, DB_LOGIN, DB_PASSWORD);
		$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
		return $db;
	}
	
	static public function assoc() {
		if (!class_exists('PDO')) {
			throw new Exception('Could not connect to database, PDO method does not exists on this server');
		};
		$assoc = PDO::FETCH_ASSOC;
		return $assoc;
	}
		
}

?>